<template>
<view>
	<view class="header">
		<view class="header_remark">剩余简历份数:{{seeNum}}</view>
		<view class="header_buy" @click="jump">购买</view>
	</view>
	<view class="list" v-for="(item,index) in list" :key="index">
		<view class="orderNum">
			<view>订单号:{{item.orderNum}}</view>
			<view class="pay1" v-if="item.payType == 1">未支付</view>
			<view class="pay2" v-if="item.payType == 2">支付成功</view>
			<view class="pay3" v-if="item.payType == 3">支付失败</view>
		</view>
		<view class="orderNum">
			<view>套餐名称:{{item.vipName}}</view>
			<view class="red">到期时间:{{item.etime}}</view>
		</view>
		<view class="orderNum">
			<view class="money">剩余简历份数:{{item.seeNum}}</view>
			<view class="money">剩余群发数:{{item.messageNum}}</view>
		</view>
		<view class="item">
			支付方式:
			<text v-if="item.payMoney > 0">微信:{{item.payMoney}}</text>
			<text v-if="item.payScore > 0">积分:{{item.payScore}}</text>
		</view>
		<view class="time">购买日期:{{item.addtime}}</view>
	</view>
</view>
</template>
<script>
import request from '@/util/request.js'
export default {
	data() {
		return{
			list:[],
			page:1,
			pageShow:true,
			seeNum:''
		}
	},
	onLoad:function(){
		uni.showLoading({
		    title: '加载中'  
		});
		this.getlist();
		this.getSeeNum()
	},
	methods: {
		getSeeNum:function(){
			var that = this;
			var data = {
				uid:uni.getStorageSync('uid')
			}
			request({
				url:'vip/seeNum',
				method: 'get',
				data:data,
				success: (res) => {
					that.seeNum = res.data.data
				},
			})
		},
		getlist:function(){
			var that = this;
			var data = {
				uid:uni.getStorageSync('uid'),
				page:this.page
			}
			request({
				url: 'vip/buyLIst',
				method: 'get',
				data:data,
				success: (res) => {
					uni.hideLoading();
					if(res.data.code == 1){
						if(res.data.data.last_page <= that.page){
							that.pageShow = false
						}
						if(that.page == 1){
							that.list = res.data.data.data
						}else{
							var list = that.list
							that.list = list.concat(res.data.data.data)
						}
					}
				}
			})
		},
		onReachBottom: function(){
			if(this.pageShow){
				 //当前不是最后一页可加载
				 this.page = this.page + 1
				 uni.showLoading()
				 this.getlist();
			}
		},
		jump:function(){
			console.log(1233)
			uni.navigateTo({
				url:'/pages/vip/index'
			})
		}
	}
}
</script>
<style>
.header{
	width:100%;
	height:80rpx;
	background:#00b359;
	color:#fff;
	line-height: 80rpx;
	text-align: center;
	font-size: 15px;
	display:flex;
	flex-direction: row;
	align-items: center;
}
.header_remark{
	width:70%;
}
.header_buy{
	width:150rpx;
	height:50rpx;
	background:#fff;
	border-radius: 25rpx;
	color:#000;
	line-height: 50rpx;

}
.list{
	display: flex;
	flex-direction: column;
	border-bottom: 5rpx solid #CCCCCC;
	padding:15rpx 15rpx 15rpx 15rpx;
}
.orderNum{
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	height:80rpx;
	line-height: 80rpx;
}
.pay1{
	width:120rpx;
	height: 50rpx;
	line-height: 50rpx;
	border-radius: 25rpx;
	background: #ff1a1a;
	text-align: center;
	color:#FFFFFF;
	font-size: 12px;
}
.pay2{
	width:120rpx;
	height: 50rpx;
	line-height: 50rpx;
	border-radius: 25rpx;
	background: #009900;
	text-align: center;
	color:#FFFFFF;
	font-size: 12px;
}
.pay3{
	width:120rpx;
	height: 50rpx;
	line-height: 50rpx;
	border-radius: 25rpx;
	background:#FF7800;
	text-align: center;
	color:#FFFFFF;
	font-size: 12px;
}
.item{
	height:80rpx;
	line-height: 80rpx;
	color:#009900;

}
.money{
    color: #2de09f;
    font-weight: 600;
}
.time{
	font-size:13px;
	margin-top:15rpx;
}
.red{
	color:#ff1a1a;
}
</style>